﻿using System.Web.Mvc;
using eCommMongo.Core;
using eCommMongo.Core.Domain.Customers;

namespace eCommMongo.Web.Controllers
{
    public class BaseController : Controller
    {
        

        protected string GetShopId()
        {
            var workContext = EngineContext.Current.Resolve<IWorkContext>();
            if (workContext != null)
            {
                if (workContext.CurrentCustomer.IsAdmin())
                {
                    return "0";
                }
                else
                {
                    var shopId = workContext.CurrentCustomer.Shop.Id
                                    ;
                    return shopId;
                }

            }
            return "0";
        }

        public ActionResult AccessDeniedView()
        {
            //return new HttpUnauthorizedResult();
            return View("AccessDenied");
        }
    }
}
